package com.ruoyi.utils;

import javax.imageio.ImageIO;
import java.awt.*;
import java.io.File;
import java.io.IOException;

/**
 * 文件工具类
 *
 * @author: Gao Tianle
 * @date: 2023-11-10 15:10
 **/
public class FileUtils {
    /**
     * 判断是图片类型
     *
     * @param file
     * @return
     */
    public static boolean isImage(File file) {
        try {
            Image image = ImageIO.read(file);
            return image != null;
        } catch (IOException ex) {
            return false;
        }
    }
}
